package com.shujia.mr.wc2;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

/*
    The books chronicle the adventures of the adolescent wizard Harry Potter and his best friends Ron Weasley
    and Hermione Granger,
    all of whom are students at Hogwarts School of Witchcraft and Wizardry.
 */
public class HarrayDemo {
    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);
        job.setJobName("27期 哈利波特单词统计案例");
        job.setJarByClass(HarrayDemo.class);

        job.setNumReduceTasks(2);

        job.setMapperClass(HarrayMapper.class);
        job.setReducerClass(HarrayReducer.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(LongWritable.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(LongWritable.class);

        FileInputFormat.addInputPath(job,new Path(args[0]));
        FileOutputFormat.setOutputPath(job,new Path(args[1]));

        job.waitForCompletion(true);

    }
}
